package org.cll.lagou.study.minicat.server;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;

/**
 * 描述信息:
 *
 * @author CLL
 * @version 1.0
 * @date 2020/7/2 21:42
 */
public class DemoServlet extends AbstractHttpServlet {

    private static final Logger logger = LoggerFactory.getLogger(DemoServlet.class);

    @Override
    protected void doGet(IRequest iRequest, IResponse iResponse) throws IOException {
        /*try {
            Thread.sleep(100000);
        } catch (InterruptedException ie) {
            logger.error("****** 中断异常" + ie.getMessage(), ie);
        }*/
        String content = "<h1> DEMO SERVLET FOR GET </h1>";
        iResponse.outputResponseStream(IHttpProtocolUtil.getHttpResponse200(content));
    }

    @Override
    protected void doPost(IRequest iRequest, IResponse iResponse) {
        String content = "<h1> DEMO SERVLET FOR GET </h1>";
        try {
            iResponse.outputResponseStream(IHttpProtocolUtil.getHttpResponse200(content));
        } catch (IOException e) {
            logger.error("****** 响应异常" + e.getMessage(), e);
        }
    }

    @Override
    public void init() {

    }

    @Override
    public void destroy() {

    }
}
